Hackerrank – Problem Statement
Solution
I created solution in:
All solutions are also available on my GitHub.
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import java.util.*; public class JavaStringsIntroduction { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); String a = stdin.next(); String b = stdin.next(); int length = a.length() + b.length(); String lexLager = a.compareToIgnoreCase(b) > 0 ? "Yes" : "No"; String capitalizedA = a.substring(0, 1).toUpperCase() + a.substring(1); String capitalizedB = b.substring(0, 1).toUpperCase() + b.substring(1); System.out.println(length); System.out.println(lexLager); System.out.println(capitalizedA + " " + capitalizedB); } } |